package com.sfd.core.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sfd.core.entity.User;
import com.sfd.core.mapper.UserMapper;
import com.sfd.core.service.UserService;
import org.springframework.stereotype.Service;

/**
 * @author haden
 * @date 2022/8/4 11:24
 **/
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {

    @Override
    public void saveUser(User u) {
        save(u);
    }

    @Override
    public User getByPhone(String phone) {
        return lambdaQuery().eq(User::getPhone, phone).one();
    }

    @Override
    public User getUserByName(String username) {
        return lambdaQuery().eq(User::getUsername, username).one();
    }
}
